{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "3624b59d-715e-49cd-b36a-1fe74d401219",
   "metadata": {},
   "source": [
    "# NumPy2"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "bc3ad9b8-287c-412c-b92a-3c6986410aae",
   "metadata": {},
   "source": [
    "## 统计相关的方法\n",
    "\n",
    "大多数同时提供了函数和方法两种调用方式\n",
    "\n",
    "- 总和 sum\n",
    "- 均值 mean\n",
    "- 中位数（1/2分位数） median\n",
    "- 分位数 quantile\n",
    "- 最值 max/min\n",
    "- 全距 ptp\n",
    "- 方差 var\n",
    "- 标准差 std"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "510c0544-b390-4fe0-87d9-626e553b588f",
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import pandas as pd\n",
    "import matplotlib.pyplot as plt"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "d282a4cf-3493-40fe-a962-b344d3a261e0",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([56, 70, 22, 64, 38, 28, 34, 75, 84, 19], dtype=int32)"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "array1 = np.random.randint(1, 100, 10)\n",
    "array1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "751f5515-11f2-44c3-94aa-99872ad97888",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(np.int64(490), np.int64(490))"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 总和\n",
    "array1.sum(), np.sum(array1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "fb99401d-f675-4163-abd0-31f05ec961d6",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(np.float64(49.0), np.float64(49.0))"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 均值\n",
    "array1.mean(), np.mean(array1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "5b082795-a9ae-4924-9c90-87c43513e5b0",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(np.float64(47.0), np.float64(47.0))"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 中位数\n",
    "np.median(array1), np.quantile(array1, 0.5)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "8501c4a6-c199-4077-aba4-b68d3d62bce8",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(np.int32(84), np.int32(84))"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 最大值\n",
    "array1.max(), np.max(array1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "f1b5344a-dd87-4d71-9cfa-4a788caeea7f",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(np.int32(19), np.int32(19), np.int32(19))"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 最小值,amin是min的别名\n",
    "array1.min(), np.min(array1), np.amin(array1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "8c1ff831-a5fa-433d-851b-1261651d2709",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "np.int32(65)"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 全距，值为最大值减去最小值\n",
    "np.ptp(array1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "3875dcce-b64c-469a-9d5c-c4eb0d44d00f",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "39.0\n"
     ]
    }
   ],
   "source": [
    "# 1/4分位数到3/4分位数的距离\n",
    "q1, q3 = np.quantile(array1, [0.25, 0.75])\n",
    "print(q3 - q1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "acdbfaa7-34d8-4ab5-abdc-aa868a16a9cf",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(np.float64(503.2), np.float64(503.2))"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 方差\n",
    "array1.var(), np.var(array1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "1f132d3a-12e2-4b6c-a5fa-7100c6e86f92",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(np.float64(22.432119828495924), np.float64(22.432119828495924))"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 标准差\n",
    "array1.std(), np.std(array1)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "d383cdd1-c9a3-4626-8ead-2c917fe90edb",
   "metadata": {},
   "source": [
    "## 其他方法\n",
    "\n",
    "1. `all()` / `any()`方法：判断数组是否所有元素都是`True` / 判断数组是否有为`True`的元素。\n",
    "\n",
    "2. `astype()`方法：拷贝数组，并将数组中的元素转换为指定的类型。\n",
    "\n",
    "3. `reshape()`方法：调整数组对象的形状。\n",
    "\n",
    "4. `dump()`方法：保存数组到二进制文件中，可以通过 NumPy 中的`load()`函数从保存的文件中加载数据创建数组。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "id": "21dbbf96-707e-4ab7-b017-069956990af7",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[ 0,  1,  2,  3],\n",
       "       [ 4,  5,  6,  7],\n",
       "       [ 8,  9, 10, 11]])"
      ]
     },
     "execution_count": 28,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "array = np.arange(12).reshape(3, 4)\n",
    "array"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "d30bef9e-5366-493e-b61a-e2addc58f5ba",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[ 0,  1,  2,  3],\n",
       "       [ 4,  5,  6,  7],\n",
       "       [ 8,  9, 10, 11]])"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 将数组保存到二进制文件array1-data中\n",
    "array.dump('array1-data')\n",
    "array3 = np.load('array1-data', allow_pickle=True)\n",
    "array3"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "d80bc1a8-e149-49dd-9ae4-2dba42d24d33",
   "metadata": {},
   "source": [
    "5. tofile()方法：将数组对象写入文件中。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "id": "c740991c-d18f-4d74-81b3-c4dcb26364d7",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 将数组保存为txt文件\n",
    "array1.tofile('array.txt', sep=',')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "id": "6199a80a-973d-4b1c-abd1-97c2e7fee2d3",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      " 驱动器 C 中的卷是 OS\n",
      " 卷的序列号是 48D6-AFFA\n",
      "\n",
      " C:\\Users\\d111k\\Desktop\\py\\data-analysis 的目录\n",
      "\n",
      "2025/11/28  09:20    <DIR>          .\n",
      "2025/11/26  12:58    <DIR>          ..\n",
      "2025/11/28  08:36    <DIR>          .ipynb_checkpoints\n",
      "2025/11/26  13:26             9,249 01-basic.ipynb\n",
      "2025/11/28  08:37         1,570,463 02-numpy1.ipynb\n",
      "2025/11/28  09:20            37,881 02-numpy2.ipynb\n",
      "2025/11/28  09:21                29 array.txt\n",
      "2025/11/28  09:20               305 array1-data\n",
      "2025/11/27  15:54    <DIR>          images\n",
      "               5 个文件      1,617,927 字节\n",
      "               4 个目录 144,424,673,280 可用字节\n"
     ]
    }
   ],
   "source": [
    "!dir"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "2eaef0b7-67b1-485a-a40f-6efabcd426d5",
   "metadata": {},
   "source": [
    "6. fill()方法：向数组中填充指定的元素。\n",
    "\n",
    "7. flatten()方法：将多维数组扁平化为一维数组。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "id": "0785db4d-603f-43c2-b010-1b90a35a451f",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([ 0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11])"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "array.flatten()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "592d5231-4548-4339-a67b-5cf19cc351e6",
   "metadata": {},
   "source": [
    "8. nonzero()方法：返回非0元素的索引。\n",
    "\n",
    "9. round()方法：对数组中的元素做四舍五入操作。\n",
    "\n",
    "10. sort()方法：对数组进行就地排序。\n",
    "\n",
    "11. swapaxes()和transpose()方法：交换数组指定的轴和转置。\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "id": "5317c2cf-0560-4a34-88da-fb0c6380cab3",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(array([[ 0,  4,  8],\n",
       "        [ 1,  5,  9],\n",
       "        [ 2,  6, 10],\n",
       "        [ 3,  7, 11]]),\n",
       " array([[ 0,  4,  8],\n",
       "        [ 1,  5,  9],\n",
       "        [ 2,  6, 10],\n",
       "        [ 3,  7, 11]]),\n",
       " array([[ 0,  1,  2,  3],\n",
       "        [ 4,  5,  6,  7],\n",
       "        [ 8,  9, 10, 11]]))"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "array.swapaxes(0, 1), array.transpose(), array"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "239fe357-3220-4791-bd7e-8e0c9b409923",
   "metadata": {},
   "source": [
    "12. tolist()方法：将数组转成 Python 中的list。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "id": "40ed4e32-f108-4321-8f7a-9c608a59f4bf",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "([[0, 1, 2, 3], [4, 5, 6, 7], [8, 9, 10, 11]], list)"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "array.tolist(), type(array.tolist())"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "664cd287-c940-4626-bd66-1ef0ecd4db71",
   "metadata": {},
   "source": [
    "## 箱线图\n",
    "\n",
    "箱线图又称为盒须图，是显示一组数据分散情况的统计图，因形状如箱子而得名。 它主要用于反映原始数据分布的特征，还可以进行多组数据分布特征的比较。\n",
    "\n",
    "- 顶部横线表示最大值max\n",
    "- 矩形第一条横线边表示3/4分位数Q3\n",
    "- 矩形中心点表示均值\n",
    "- 矩形里面的横线表示中位数\n",
    "- 矩形第二条横线边表示1/4分位数Q1\n",
    "- 底部横线表示最小值min"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "id": "2d3e7afd-4e14-4f52-8830-8554d7606fa8",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAioAAAGiCAYAAADJO+2bAAAAOnRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjEwLjcsIGh0dHBzOi8vbWF0cGxvdGxpYi5vcmcvTLEjVAAAAAlwSFlzAAAPYQAAD2EBqD+naQAAG3pJREFUeJzt3XuQV3X9+PHXIleRi2CwMMIXMhJMwwBF1BzRHfESSZJGwYRK0HihEEtlEsyySCozFEEdB3K8ZM4EpVM0hCHjuCJClBogjKAos2A/ZZE7uvubc37f3Z+r0AX57Oe9u4/HzJnPnsuefS9/uE/f55zPp6S6uro6AAAS1KzYAwAAOBihAgAkS6gAAMkSKgBAsoQKAJAsoQIAJEuoAADJEioAQLKECgCQLKECADS+UFm6dGkMHz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B9WCjRNQgVIzs6dO6N///4xa9asYg8FKLJ6+/RkgP/UBRdckC8AZlQAgGQJFQAgWUIFAEiWUAEAkiVUAIBkeeoHSM6OHTti/fr1tesbNmyIVatWRadOnaJnz55FHRtQv3x6MpCcJUuWxNChQz+yfezYsTFv3ryijAkoDqECACTLPSoAQLKECgCQLKECACRLqAAAyRIqAECyhAoAkCyhAgAkS6gAAMkSKgBAsoQKAJAsoQIARKr+Lz+HtPcFNNIqAAAAAElFTkSuQmCC",
      "text/plain": [
       "<Figure size 640x480 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# 箱线图\n",
    "plt.boxplot(array1, showmeans=True)\n",
    "plt.ylim([-20, 120]) # y轴刻度线范围\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "ccaf7116-ae4c-4416-9214-a2ff5e3eefb2",
   "metadata": {},
   "source": [
    "有多个维度的数组应该分别分析各个轴的箱型图。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "id": "712c483b-7396-46b1-824d-f16e84e61dc7",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[68, 91, 63],\n",
       "       [78, 67, 63],\n",
       "       [95, 91, 75],\n",
       "       [86, 65, 87],\n",
       "       [91, 60, 74]], dtype=int32)"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "array2 = np.random.randint(60, 101, (5, 3))\n",
    "array2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "id": "38b5cf63-2667-4056-9b35-b6aa80df2dd0",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "np.float64(76.93333333333334)"
      ]
     },
     "execution_count": 21,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 均值\n",
    "array2.mean()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "id": "e22bde8a-a5f1-479a-b8bb-626fddba11e2",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([83.6, 74.8, 72.4])"
      ]
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 0轴的均值，每列的均值\n",
    "array2.mean(axis=0)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "id": "042b72ba-92d4-4995-86df-5fc10b48f09d",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([74.        , 69.33333333, 87.        , 79.33333333, 75.        ])"
      ]
     },
     "execution_count": 23,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 1轴的均值，每行的均值\n",
    "array2.mean(axis=1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "id": "6ff5bed7-7807-4916-a869-5ce5ffa910d0",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([95, 91, 87], dtype=int32)"
      ]
     },
     "execution_count": 24,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 最大值，每列的最大值\n",
    "array2.max(axis=0)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "id": "951bb1ac-5806-418a-84b0-a21c359bfda6",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([91, 78, 95, 87, 91], dtype=int32)"
      ]
     },
     "execution_count": 25,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 每行的最大值\n",
    "array2.max(axis=1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "id": "a91a7754-f078-4256-9007-c03a0a581829",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAioAAAGiCAYAAADJO+2bAAAAOnRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjEwLjcsIGh0dHBzOi8vbWF0cGxvdGxpYi5vcmcvTLEjVAAAAAlwSFlz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C8W0f6+92hY1RSY5LBgwcXjw0NDUWVZfLkya3njBkzJkaOHFkElUNpamoqPtzBGwDQNXVYUGlubo45c+bEpEmT4vTTTy+ONTY2Rq9evWLQoEFtzh06dGjx3OHGvaQEVtpGjBjRIe0HALpwUEljVV588cV4+OGH39V16urqispMadu4ceMxayMAkJeeHfEm11xzTTz22GOxYsWKOOWUU1qP19TUxP79+2Pbtm1tqipp1k967lB69+5dbABA11fWikoap5tCypIlS+KJJ56IUaNGtXm+trY2jj/++Fi+fHnrsTR9+Re/+EVMnDixnE0DALp7RSV196QZPT/60Y+KtVRK407S2JK+ffsWjzNnzoy5c+cWA2zTqN9rr722CClHMuMHAOjayjo9uaqq6pDHFy9eHFdccUXrgm/XX399/OAHPyhm9EyZMiW++93vHrbr561MTwaAzudIf787dB2VchBUAKDzyXIdFQCAoyGoAADZElQAgGwJKgBAtgQVACBbggoAkC1BBQDIlqACAGRLUAEAsiWoAADZElQAgGwJKgBAtgQVACBbggoAkC1BBQDIlqACAGRLUAEAsiWoAADZElQAgGwJKgBAtgQVACBbggoAkC1BBQDIlqACAGRLUAEAsiWoAADZElQAgGwJKgBAtgQVACBbggoAkC1BBQDIlqACAGRLUAEAsiWoAADZElQAgGwJKgBAtgQVACBbggoAkC1BBQDIlqACAGRLUAEAsiWoAADZyiKo3HvvvXHqqadGnz59YsKECfHss89WukkAQAYqHlR++MMfxty5c+OWW26JVatWxZlnnhlTpkyJLVu2VLppAECFVbW0tLRUsgGpgnLOOefEd77znWK/ubk5RowYEddee23cdNNNbzu/qamp2Ep27NhRnL99+/YYOHBgh7YdAGif9PtdXV39W3+/K1pR2b9/fzQ0NMTkyZN/06AePYr9+vr6Q75m/vz5xQcrbSmkAABdU0WDyv/8z//Em2++GUOHDm1zPO03NjYe8jV1dXVF+iptGzdu7KDWAgAdrWd0Mr179y42AKDrq2hF5aSTTorjjjsuNm/e3OZ42q+pqalYuwCAPFQ0qPTq1Stqa2tj+fLlrcfSYNq0P3HixEo2DQDIQM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L2VZRyWFlI985CPFbJw0LuX1118vxp2kreSLX/xiMZA2rbeyevXq+OEPfxh33313m/EndKzUpZbWu3lr1xpUiu8kufGd7CLTk++///648sorD/ncwW+XFny7+uqrY+XKlXHSSSfFtddeGzfeeOOxbg4A0El12DoqAABHy71+AIBsCSoAQLYEFQAgW4IKAJAtQYVYsWJFXHLJJcUyxuk2BOnGkFAp6X5e55xzTgwYMCBOPvnkmDZtWqxbt67SzaKbSzfS/dCHPtS6Im1aC+zHP/5xpZvVLQgqxO7du+PMM8+Me++9t9JNgXjyySeLZQuefvrpYhHItCjkRRddVHxPoVJOOeWUuP3226OhoSGee+65+OhHPxpTp04t1gGjvExPpo1UUVmyZEnxr1jIQVowMlVWUoBJd1yHXAwePDi+8Y1vFAuXUj4dcvdkgPbavn17648C5ODNN9+MRx55pKjypS4gyktQAbLV3Nwcc+bMiUmTJsXpp59e6ebQzb3wwgtFMNm3b1/079+/qD6PGzeu0s3q8gQVIFtprMqLL74YP/3pTyvdFChumvv8888XVb5//Md/jBkzZhRdksJKeQkqQJauueaaeOyxx4pZaWkgI1RaupHu+9///uLv2tra4j516Wa6ixYtqnTTujRBBchKGt+fblCayuo/+clPYtSoUZVuEhy2a7KpqanSzejyBBVi165d8fLLL7fub9iwoShvpsGLI0eOrGjb6J7dPQ899FD86Ec/KtZSaWxsLI5XV1dH3759K908uqm6urr4xCc+Ufw/cefOncV3NAXpf/3Xf61007o805Mp/mO78MIL33Y89b/ef//9FWkT3XuK/KEsXrw4rrjiig5vDyRpCvLy5cvjv//7v4vQnBZ/u/HGG+PjH/94pZvW5QkqAEC2rEwLAGRLUAEAsiWoAADZElQAgGwJKgBAtgQVACBbggoAkC1BBQDIlqACAGRLUAEAsiWoAACRq/8PR3krTPJZaXIAAAAASUVORK5CYII=",
      "text/plain": [
       "<Figure size 640x480 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# 箱型图，每列一个箱型图\n",
    "plt.boxplot(array2, showmeans=True)\n",
    "plt.ylim([-20, 120])\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "a3a30009-0b79-4f34-a977-d0d5959c0f40",
   "metadata": {},
   "source": [
    "## scipy\n",
    "\n",
    "scipy库提供了更多统计方法"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "id": "a513f7ea-1aee-4c96-8115-20b2436ddec4",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "49.0\n",
      "43.43505159406725\n",
      "38.0903165830337\n",
      "49.0\n",
      "0.4577983638468556\n",
      "0.11321915393634077\n",
      "-1.4967843322608123\n"
     ]
    }
   ],
   "source": [
    "from scipy import stats\n",
    "\n",
    "print(np.mean(array1))                # 算术平均值\n",
    "print(stats.gmean(array1))            # 几何平均值\n",
    "print(stats.hmean(array1))            # 调和平均值\n",
    "print(stats.tmean(array1, [10, 90]))  # 去尾平均值\n",
    "print(stats.variation(array1))        # 变异系数\n",
    "print(stats.skew(array1))             # 偏态系数\n",
    "print(stats.kurtosis(array1))         # 峰度系数"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "4d0f84d1-2d99-4c4d-9ff1-7a30877d3c1d",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.13.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
